]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
userWidget: Fix leaking instances
authorRui Matos <tiagomatos@gmail.com>
Tue, 21 May 2013 19:33:04 +0000 (21:33 +0200)
committerRui Matos <tiagomatos@gmail.com>
Tue, 21 May 2013 19:59:14 +0000 (21:59 +0200)
UserWidget instances should be destroyed when the actor is. That's
what consumer code expects since the destroy() method is never called.

https://bugzilla.gnome.org/show_bug.cgi?id=700807

js/ui/userWidget.js

index 06de0fc64e67668b08118d7307259928bea0eefa..433b0bf60825f7bb5ac91ac15315bc9130b30594 100644 (file)
@@ -16,6 +16,7 @@ const UserWidget = new Lang.Class({
 
         this.actor = new St.BoxLayout({ style_class: 'user-widget',
                                         vertical: false });
+        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
 
         this._avatar = new UserMenu.UserAvatarWidget(user);
         this.actor.add(this._avatar.actor,
@@ -36,7 +37,7 @@ const UserWidget = new Lang.Class({
             this._updateUser();
     },
 
-    destroy: function() {
+    _onDestroy: function() {
         if (this._userLoadedId != 0) {
             this._user.disconnect(this._userLoadedId);
             this._userLoadedId = 0;
@@ -46,8 +47,6 @@ const UserWidget = new Lang.Class({
             this._user.disconnect(this._userChangedId);
             this._userChangedId = 0;
         }
-
-        this.actor.destroy();
     },
 
     _updateUser: function() {